class GradeEntry < ActiveRecord::Base
    validates_presence_of :person_id, :assignment_id, :grade
    validates_numericality_of :person_id, :assignment_id, :grade
    #errors.add(:grade, "Not a valid Grade") if :grade.nil? || :grade < 0.0 

    has_many :persons
    has_many :assignments
    
    def self.get_student_grades(person_id, assignment)
      person = person_id
      find(:first, :conditions => "person_id = '#{person}' AND assignment_id = #{assignment}", :order => "assignment_id")
    end
    
    
end
